<template>
  <div class="j-flag">
    <ul>
      <li v-for="(item,index) in allData" :key="index">
        <div class="head">
          <span class="icon-3" @click="sentSongUrl(item.song)"></span>
          <span class="num">{{index+1}}.</span>
        </div>
        <div class="song">
          <div class="tt">
                <span class="txt">
                  <a href="#" class="tex-a">
                    <b :title="item.song.name">{{ item.song.name }}</b>
                  </a>
                  <span class="s-fc8">
                    <em>-</em>
                    <span :title="item.song.ar.name" v-if="item.song.ar">
                      <a href="#">{{ item.song.ar[0].name }}</a>
                    </span>
                  </span>
                </span>
          </div>
          <div class="oper">
            <a href="javascript:;" title="添加到播放列表" @click.prevent="addSongList(item.song)"></a>
            <span class=" s-bg-11" title="收藏">收藏</span>
            <span class=" u-icn-81" title="分享">分享</span>
            <span class=" s-bg-12" title="下载">下载</span>
          </div>
        </div>
        <div class="tops">
          <span class="bg" :style='`width: ${item.score}%;`'></span>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: "index",
  props:['allData'],
  methods:{
    sentSongUrl(i){
      this.$store.commit('track/SETMUSIC',i)
    },
    addSongList(i){
      this.$store.commit('track/ADDMUSICLIST',i)
    },
  }

}
</script>

<style scoped lang="less">
.j-flag{
  ul {
    width: 900px;
    margin: 0 auto;
    border: 1px solid #e2e2e2;
    border-top: none;

    li {
      //position: relative;
      width: 100%;
      height: 38px;
      line-height: 38px;
      overflow: hidden;

      &:nth-child(even) {
        background-color: #F7F7F7;
      }

      &:hover {
        background-color: #E6E6E6;
      }

      &:hover .txt {
        width: 80%;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
      }

      &:hover .oper {
        display: block !important;
      }

      &:hover .u-dur {
        display: none;
      }

      .head {
        float: left;
        width: 72px;
        height: 38px;
        overflow: hidden;

        .icon-3 {
          float: right;
          display: inline;
          margin-top: 10px;
          width: 17px;
          height: 17px;
          cursor: pointer;
          background-position: 0 -103px;
          background-image: url("../../../../assets/table.png");
          &:hover{
            background-position: -0px -128px;
            cursor: pointer;
          }
        }

        .num {
          float: left;
          display: inline;
          padding-left: 5px;
          padding-right: 8px;
          width: 37px;
          text-align: right;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          font-size: 16px;
          color: #666;

        }
      }

      .song {
        float: left;
        position: relative;
        z-index: 1;
        zoom: 1;

        padding-left: 10px;
        width: 490px;
        height: 38px;
        overflow: hidden;

        .tt {
          float: left;
          width: 100%;

          .txt {
            position: relative;
            display: inline-block;
            max-width: 99%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;

            .tex-a {
              b {
                color: #000;
                font-weight: bold;
              }
            }

            .s-fc8 {
              color: #aeaeae;

              em {
                margin: 0 5px
              }

              span {
                color: #aeaeae;

                a {
                  color: #aeaeae;
                }
              }
            }
          }
        }

      }

      .tops {

        float: right;
        position: relative;
        z-index: 1;
        zoom: 1;
        width: 319px;
        height: 38px;
        line-height: 38px;

        .bg {
          position: absolute;
          z-index: 1;

          height: 38px;
          background-color: #4eb4f5;
          opacity: 0.1;
        }
      }

      .oper {
        position: absolute;
        z-index: 1;
        right: 0;
        top: 11px;
        display: none;
        width: 92px;
        height: 20px;
        overflow: hidden;

        a {
          width: 13px;
          height: 13px;
          float: left;
          margin-top: 2px;
          display: inline-block;

          background: url("../../../../assets/icon.png") no-repeat 0 -700px;
          &:hover{
            background-position: -22px -700px;
          }
        }

        .s-bg-11 {
          float: left;
          width: 18px;
          height: 16px;
          margin: 2px 0 0 4px;
          overflow: hidden;
          text-indent: -999px;
          cursor: pointer;
          background: url("../../../../assets/table.png") no-repeat 0 -174px;
          &:hover{
            background-position: -20px -174px;
          }
        }

        .u-icn-81 {
          float: left;
          width: 18px;
          height: 16px;
          margin: 2px 0 0 4px;
          overflow: hidden;
          text-indent: -999px;
          cursor: pointer;
          background: url("../../../../assets/table.png") no-repeat 0 -195px;
          &:hover{
            background-position: -20px -195px;
          }
        }

        .s-bg-12 {
          float: left;
          width: 18px;
          height: 16px;
          margin: 2px 0 0 4px;
          overflow: hidden;
          text-indent: -999px;
          cursor: pointer;
          background: url("../../../../assets/table.png") no-repeat -81px -174px;
          &:hover{
            background-position: -104px -174px;
          }
        }
      }
    }
  }

}
</style>